//
//  GradientsBootcamp.swift
//  SwiftUiExercise
//
//  Created by 徐鹏 on 2023/6/23.
//

import SwiftUI

struct GradientsBootcamp_06: View {
    var body: some View {
        
        VStack{
            
            RoundedRectangle(cornerRadius: 25.0)
                .fill(
                                    LinearGradient(
                                        gradient: Gradient(colors: [Color.red,Color.blue]),
                                        startPoint: .topLeading,
                                        endPoint: .bottom)
                    
                )
                .frame(width: 300,height: 200)

            
            RoundedRectangle(cornerRadius: 25.0)
                .fill(
                  
                                    RadialGradient(
                                        gradient: Gradient(colors: [Color.red,Color.blue]),
                                        center: .center,
                                        startRadius: 5,
                                        endRadius: 400
                                    )
                   
                )
                .frame(width: 300,height: 200)

            
            RoundedRectangle(cornerRadius: 25.0)
                .fill(
                    //                LinearGradient(
                    //                    gradient: Gradient(colors: [Color.red,Color.blue]),
                    //                    startPoint: .topLeading,
                    //                    endPoint: .bottom)
                    //                RadialGradient(
                    //                    gradient: Gradient(colors: [Color.red,Color.blue]),
                    //                    center: .center,
                    //                    startRadius: 5,
                    //                    endRadius: 400
                    //                )
                    AngularGradient(
                        gradient: Gradient(colors: [Color.red,Color.blue]),
                        center: .center,
                        angle: .degrees(90)
                    )
                )
                .frame(width: 300,height: 200)
        }

    }
}

struct GradientsBootcamp_Previews: PreviewProvider {
    static var previews: some View {
        GradientsBootcamp_06()
    }
}
